﻿using XYS.Core.Models;
using XYS.Service.Core.Models;

namespace XYS.Core.Util.Helper;

/// <summary>
/// 
/// </summary>
public static class ActivateServicesHelper
{
    /// <summary>
    /// 获取所有服务
    /// </summary>
    /// <returns></returns>
    public static List<EnumActivateService> ALLActivateService() => EnumHelper.GetValues<EnumActivateService>().Where(x => x != EnumActivateService.Nothing && x != EnumActivateService.ALL).ToList();

    /// <summary>
    /// 获取所有服务枚举
    /// </summary>
    /// <returns></returns>
    public static EnumActivateService EnumActivateServiceALL() => ALLActivateService().Aggregate((acc, flag) => acc | flag);

    /// <summary>
    /// 非独立权限的服务
    /// </summary>
    /// <returns></returns>
    public static List<EnumActivateService> NoIndependentPermissionsActivateService() =>
        EnumHelper.GetValues<EnumActivateService>()
        .Where(x => x != EnumActivateService.Nothing && x != EnumActivateService.ALL
        && !GlobalCoreSetting.IndependentPermissions.Contains(x))
        .ToList();

}
